home *** CD-ROM | disk | FTP | other *** search
- Date: Thu, 4 Mar 93 12:09:30 PST
- From: ???
- Subject: Re: Secure X Server Tutorial
-
-
- The increasing popularity of the X Window System has brought with it an
- ever-growing number of people willing to take advantage of its security
- holes. There are publicly available programs which can display every
- character typed to an xterm window. If you're only using xhost's host-based
- method of access control as your means of security, you can assume that
- everything you type *including passwords* can be read by a cracker.
-
- Fortunately, X provides a way to secure your communications. This message
- addresses how to accomplish this whether you use xdm, openwin or some other
- xinit-based method to start up your server.
-
- I) XDM
-
- If you're using the Software Warehouse 'xdm' with the default configuration
- files to manage your workstation display, you should already have
- authentication. If you're using 'xdm' from another source, you may need to
- change a few things to get it working.
-
- The most general method is to edit the xdm-config file. Simply change the
- 'DisplayManager*authorize' resource to 'true'. You should also verify that
- 'DisplayManager._0.authorize' and 'DisplayManager*authComplain' are also
- set to 'true'. These changes will take effect the next time you start up
- xdm.
-
- If you can't change the xdm-config file for some reason, you can specify
- these resources with the -xrm flag when you start xdm. Something like
-
- xdm -xrm 'DisplayManager*authorize: true'
-
- will enable authorization.
-
- II) xinit (or programs like startx, which use xinit)
-
- If you start X using 'xinit' (which is probably true if you log in using
- the boring old login:/Password: prompts rather than a bitmapped box,) you
- can use the 'xauth' program to set up keys to encrypt a connection. Here
- are two easy steps to X security:
-
- 1) Save the following lines in a file named .xserverrc in your home
- directory:
-
- #!/bin/sh
-
- # generate new authorization keys each time server is started
- #
- for display in :0 `hostname`:0 localhost:0; do
- xauth create $display XDM-AUTHORIZATION-1
- done
-
- # start the server
- #
- exec X :0 -auth ${XAUTHORITY-$HOME/.Xauthority}
-
- *Note*
- The Software Warehouse version of 'xauth' implements the
- non-standard 'create' option, so this probably won't work at other
- sites. If you don't have access to the Software Warehouse, you
- can create a simple program to generate a random 32 byte string of
- hexadecimal characters (0-9a-f) and replace the 'xauth create...'
- lines with:
-
- xauth add $display XDM-AUTHORIZATION-1 `your-key-program`
-
- 2) If you use 'xinit' and specify something after the '--' option, you'll
- need to customize the final line of your .xserverrc file. For instance,
- if you usually type 'xinit -- XsunMono' (in order to use the smaller
- monochrome Sun server) the final line in your .xserverrc file would be:
-
- exec XsunMono :0 -auth ${XAUTHORITY-$HOME/.Xauthority}
-
- *Another Note*
- If you set the XAUTHORITY environment variable to anything (except
- $HOME/.Xauthority) it must be set BEFORE you run xinit, which does an
- XOpenDisplay() to verify that the server has started. If the server
- is started with a non-standard '-auth $XAUTHORITY', xinit won't be able
- to contact the server and, after several minutes of annoying messages,
- will kill the server and exit.
-
- III) openwin
-
- If you use 'openwin' to start up Sun's X/NeWS server, you can get a secure
- X session by running
-
- openwin -auth magic-cookie
-
-
- No matter which way you go about securing your connection, make *sure* to
- remove any 'xhost' commands which allow hosts access when you start X.
- .xinitrc and .xsession files are good places to check for these.
-
- The next time you start X, you should have a more secure connection.
- You can confirm this by running 'xhost' with no arguments. It should say
- something like:
-
- access control enabled, only authorized clients can connect
-
- This is still not 100% secure, since someone grabbing raw bits off the
- network could still manage to intercept your key, but it should deter
- most crackers.
-
- As long as your home directory is mounted on every machine you use, this is
- all you'll need to do. The authorization file is written in a portable
- format which works across architectures.
-
-
- If you have two or more home directories, you'll need to transfer your keys
- to a file in each home directory before you are be permitted to open new
- windows from the machine(s) served by those home directories. This is
- accomplished with the following command:
-
- xauth extract - $DISPLAY | rsh remote-machine xauth merge -
-
- (where "remote-machine" is the name of the new machine.)
-
- An easier way to do this is to use Software Warehouse version of 'xon' which
- has been hacked to support a '-auth' flag. The command
-
- xon auspex -auth &
-
- will start up an xterm window from auspex after making sure your auspex
- directory has an up-to-date .Xauthority file. The command
-
- xon manray -auth xload -geometry =100x50 &
-
- will bring up a small xload window from manray after updating the
- $XAUTHORITY file there.
-
-
-